var App = getApp();
import Toast from '../../../../miniprogram_npm/@vant/weapp/toast/toast';
import utils from '../../../../utils/utils.js';
import Dialog from '@vant/weapp/dialog/dialog';

Page({
    data: {
        imageList: [],
    },
    localphoto: function (res) {
      wx.navigateTo({ url: '/pages/index/devphoto/local/local',});
    },
    goSettle: function () {
        if (App.globalData.imageList.length <= 0) {
            Toast("请选择照片")
            return
        }
      wx.navigateTo({ url: '/pages/index/devphoto/settle/settle'});
    },
    imageClose(event) {
        App.globalData.imageList.splice(event.detail, 1);
    },
    onLoad(options) {
    },
    onShow() {
      this.setData({ imageList: App.globalData.imageList})
    },
    selectPic: function (options) {
        var _this = this

      wx.showActionSheet({
        itemList: ['聊天框上传', '本地上传'],
        success(selres) {
          if (selres.tapIndex == 0) {
            wx.chooseMessageFile({
              count: 10,
              type: 'all',
              success: function (res) {
                wx.showLoading()
                utils.uploadImg(res.tempFiles, _this)
              }
            })
          } else {
            wx.chooseImage({
              sizeType: ['original'], // 可以指定是原图还是压缩图，默认二者都有
              sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
              success: function (res) {
                utils.uploadImg(res.tempFilePaths, _this)
              }
            })
          }
        }
      })
    },


})